// Data.java

package com.ruoyi.patient.entity.order;

import com.ruoyi.service.domain.ServiceOrders;

import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.List;

@lombok.Data
public class PatientOrderDetailRet {
    private Long orderId;
    private String orderIdVO;
    private String orderCode;
    private String orderStatus;
    private String orderCreateTime;

    private List<PatientOrderInfo> orderInfo;
    private List<PatientOrderButton> buttons;

    private PatientDispatchInfo dispatchInfo;
    private PatientProofsInfo proofsInfo;
    private PatientCheckInfo checkInfo;

    private PatientServeInfo serveInfo;
    private PatientPaidInfo paidInfo;

    private String verifiCode;

    private String orderPayTip = "请在 30分钟 内完善信息并支付，否则订单将会失效";
    //private String orderProcessTip = "您的订单西峰区人民医院已经受理，资料审核并指派护士中，请保持电话畅通，耐心等待。";
    private String orderProcessTip = "您的订单东华数字医院已经受理，资料审核并指派护士中，请保持电话畅通，耐心等待。";

    public void init(ServiceOrders order) {
        this.orderId = order.getOrderId();
        this.orderIdVO = order.getOrderCode();
        DateFormat cstFormate = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        String creatTimeNew = cstFormate.format(order.getOrderCreateTime());
        this.orderCreateTime = creatTimeNew;

        switch (order.getOrderServiceflag()){
            case 2:
            case 4:
                this.setOrderCode("canceled");
                this.setOrderStatus("已取消");
                this.setOrderProcessTip("订单已取消");
                break;
            case 3:
            case 5:
            case 6:
            case 7:
            case 8:
                this.setOrderCode("unserved");
                this.setOrderStatus("待服务");
                this.setOrderProcessTip("您的订单医院已经受理，资料审核并指派护士中，请保持电话畅通，耐心等待。");
                break;
            case 9:
            case 10:
                this.setOrderCode("serving");
                this.setOrderStatus("服务中");
                this.setOrderProcessTip("您的订单护士正在服务中。");
                break;
            case 11:
            case 12:
            case 13:
                this.setOrderCode("settling");
                this.setOrderStatus("结算中");
                this.setOrderProcessTip("您的订单正在结算中。");
                break;
            case 14:
            case 15:
            case 16:
            case 17:
                this.setOrderCode("settled");
                this.setOrderStatus("已结算");
                this.setOrderProcessTip("您的订单已结算完成。");
                break;
            default:
                this.setOrderCode("all");
                //this.setOrderStatus("全部");
        }

        if(order.getOrderPay() == null){
            this.setOrderCode("unpaid");
            this.setOrderStatus("待付款");
            this.setOrderPayTip("请在 30分钟 内支付并完善信息，否则订单将会失效");
        }else if (order.getOrderServiceflag() == 1){
            this.setOrderCode("unpaid");
            this.setOrderStatus("待付款");
            this.setOrderPayTip("请在 30分钟 内支付并完善信息，否则订单将会失效");
            this.setOrderProcessTip("请尽快支付并完善信息，否则订单将会失效");
        }else if ("1".equals(order.getOrderUseFlag())){
            this.setOrderCode("unpaid");
            this.setOrderStatus("待完善");
            this.setOrderPayTip("请尽快支付并完善信息，否则订单将会失效");
            this.setOrderProcessTip("请尽快支付并完善信息，否则订单将会失效");
        }

        if((order.getOrderFlag() == 1) || (order.getOrderFlag() == 3) || (order.getOrderFlag() == 4)){
            this.setOrderCode("canceled");
            this.setOrderStatus("已取消");
            this.setOrderProcessTip("订单已取消");
        }


    }


}